<!-- HTML header for doxygen 1.8.20-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
	<meta http-equiv="X-UA-Compatible" content="IE=9"/>
	<meta name="generator" content="Doxygen 1.9.4"/>
	<meta name="viewport" content="width=device-width, initial-scale=1"/>
	<title>Raspberry Pi Pico SDK: include/hardware/i2c.h Source File</title>
	<!-- <link href="tabs.css" rel="stylesheet" type="text/css"/> -->
	<script type="text/javascript" src="jquery.js"></script>
	<script type="text/javascript" src="dynsections.js"></script>
	<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
	<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
    <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap" rel="stylesheet">
	<link href="doxygen.css" rel="stylesheet" type="text/css" />
	<link href="normalise.css" rel="stylesheet" type="text/css"/>
<link href="main.css" rel="stylesheet" type="text/css"/>
<link href="styles.css" rel="stylesheet" type="text/css"/>
</head>
<body>
	<div class="navigation-mobile">
		<div class="logo--mobile">
			<a href="/"><img src="logo-mobile.svg" alt="Raspberry Pi"></a>
		</div>
		<div class="navigation-toggle">
			<span class="line-1"></span>
			<span class="line-2">
				<p>Menu Toggle</p>
			</span>
			<span class="line-3"></span>
		</div>
	</div>
	<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
		<div class="logo">
			<a href="index.html"> <img src="logo.svg" alt="Raspberry Pi"></a>
			<span style="display: inline-block; margin-top: 10px;">
				v2.1.0
			</span>
		</div>
		<div class="navigation-footer">
			<img src="logo-mobile.svg" alt="Raspberry Pi">
			<a href="https://www.raspberrypi.com/" target="_blank">By Raspberry Pi Ltd</a>
		</div>
<!-- 		<div class="search">
			<form>
				<input type="search" name="search" id="search" placeholder="Search">
				<input type="submit" value="Search">
			</form>
		</div> -->
<!-- Generated by Doxygen 1.9.4 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search",'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('rp2__common_2hardware__i2c_2include_2hardware_2i2c_8h_source.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle"><div class="title">i2c.h</div></div>
</div><!--header-->
<div class="contents">
<a href="rp2__common_2hardware__i2c_2include_2hardware_2i2c_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno">    1</span><span class="comment">/*</span></div>
<div class="line"><a id="l00002" name="l00002"></a><span class="lineno">    2</span><span class="comment"> * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.</span></div>
<div class="line"><a id="l00003" name="l00003"></a><span class="lineno">    3</span><span class="comment"> *</span></div>
<div class="line"><a id="l00004" name="l00004"></a><span class="lineno">    4</span><span class="comment"> * SPDX-License-Identifier: BSD-3-Clause</span></div>
<div class="line"><a id="l00005" name="l00005"></a><span class="lineno">    5</span><span class="comment"> */</span></div>
<div class="line"><a id="l00006" name="l00006"></a><span class="lineno">    6</span> </div>
<div class="line"><a id="l00007" name="l00007"></a><span class="lineno">    7</span><span class="preprocessor">#ifndef _HARDWARE_I2C_H</span></div>
<div class="line"><a id="l00008" name="l00008"></a><span class="lineno">    8</span><span class="preprocessor">#define _HARDWARE_I2C_H</span></div>
<div class="line"><a id="l00009" name="l00009"></a><span class="lineno">    9</span> </div>
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno">   10</span><span class="preprocessor">#include &quot;<a class="code" href="pico_8h.html">pico.h</a>&quot;</span></div>
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno">   11</span><span class="preprocessor">#include &quot;<a class="code" href="common_2pico__time_2include_2pico_2time_8h.html">pico/time.h</a>&quot;</span></div>
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno">   12</span><span class="preprocessor">#include &quot;hardware/structs/i2c.h&quot;</span></div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno">   13</span><span class="preprocessor">#include &quot;hardware/regs/dreq.h&quot;</span></div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno">   14</span> </div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno">   15</span><span class="comment">// PICO_CONFIG: PARAM_ASSERTIONS_ENABLED_HARDWARE_I2C, Enable/disable assertions in the hardware_i2c module, type=bool, default=0, group=hardware_i2c</span></div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno">   16</span><span class="preprocessor">#ifndef PARAM_ASSERTIONS_ENABLED_HARDWARE_I2C</span></div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno">   17</span><span class="preprocessor">#ifdef PARAM_ASSERTIONS_ENABLED_I2C </span><span class="comment">// backwards compatibility with SDK &lt; 2.0.0</span></div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno">   18</span><span class="preprocessor">#define PARAM_ASSERTIONS_ENABLED_HARDWARE_I2C PARAM_ASSERTIONS_ENABLED_I2C</span></div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno">   19</span><span class="preprocessor">#else</span></div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno">   20</span><span class="preprocessor">#define PARAM_ASSERTIONS_ENABLED_HARDWARE_I2C 0</span></div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno">   21</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno">   22</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno">   23</span><span class="preprocessor">#ifdef __cplusplus</span></div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno">   24</span><span class="keyword">extern</span> <span class="stringliteral">&quot;C&quot;</span> {</div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno">   25</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno">   26</span> </div>
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno">   55</span><span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code hl_struct" href="structi2c__inst.html">i2c_inst</a> <a class="code hl_struct" href="structi2c__inst.html">i2c_inst_t</a>;</div>
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno">   56</span> </div>
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno">   57</span><span class="comment">// PICO_CONFIG: PICO_DEFAULT_I2C, Define the default I2C for a board, min=0, max=1, default=Usually provided via board header, group=hardware_i2c</span></div>
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno">   58</span><span class="comment">// PICO_CONFIG: PICO_DEFAULT_I2C_SDA_PIN, Define the default I2C SDA pin, min=0, max=47 on RP2350B, 29 otherwise, default=Usually provided via board header, group=hardware_i2c</span></div>
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno">   59</span><span class="comment">// PICO_CONFIG: PICO_DEFAULT_I2C_SCL_PIN, Define the default I2C SCL pin, min=0, max=47 on RP2350B, 29 otherwise, default=Usually provided via board header, group=hardware_i2c</span></div>
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno">   60</span> </div>
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno">   68</span><span class="keyword">extern</span> <a class="code hl_struct" href="structi2c__inst.html">i2c_inst_t</a> <a class="code hl_variable" href="group__hardware__i2c.html#ga56c7844696c095a3ad088100df011fd2">i2c0_inst</a>;</div>
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno">   69</span><span class="keyword">extern</span> <a class="code hl_struct" href="structi2c__inst.html">i2c_inst_t</a> i2c1_inst;</div>
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno">   70</span> </div>
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"><a class="line" href="rp2__common_2hardware__i2c_2include_2hardware_2i2c_8h.html#a46204d38a512926541fd8bac2b62c720">   71</a></span><span class="preprocessor">#define i2c0 (&amp;i2c0_inst) </span></div>
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"><a class="line" href="rp2__common_2hardware__i2c_2include_2hardware_2i2c_8h.html#a87659b485d9e76dfc3bcef208ac4b573">   72</a></span><span class="preprocessor">#define i2c1 (&amp;i2c1_inst) </span></div>
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno">   73</span> </div>
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno">   74</span><span class="preprocessor">#if !defined(PICO_DEFAULT_I2C_INSTANCE) &amp;&amp; defined(PICO_DEFAULT_I2C)</span></div>
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno">   75</span><span class="preprocessor">#define PICO_DEFAULT_I2C_INSTANCE() (__CONCAT(i2c,PICO_DEFAULT_I2C))</span></div>
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno">   76</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno">   77</span> </div>
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno">   91</span><span class="preprocessor">#ifdef PICO_DEFAULT_I2C_INSTANCE</span></div>
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno">   92</span><span class="preprocessor">#define i2c_default PICO_DEFAULT_I2C_INSTANCE()</span></div>
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno">   93</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno">   94</span> </div>
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno">   97</span><span class="comment">// ----------------------------------------------------------------------------</span></div>
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno">   98</span><span class="comment">// Setup</span></div>
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno">   99</span> </div>
<div class="line"><a id="l00114" name="l00114"></a><span class="lineno">  114</span>uint <a class="code hl_function" href="group__hardware__i2c.html#gad31793849a130033e94fa5b8e98a30a8">i2c_init</a>(<a class="code hl_struct" href="structi2c__inst.html">i2c_inst_t</a> *i2c, uint baudrate);</div>
<div class="line"><a id="l00115" name="l00115"></a><span class="lineno">  115</span> </div>
<div class="line"><a id="l00124" name="l00124"></a><span class="lineno">  124</span><span class="keywordtype">void</span> <a class="code hl_function" href="group__hardware__i2c.html#ga2e2ac8f345157b0095fc463ac3e584ba">i2c_deinit</a>(<a class="code hl_struct" href="structi2c__inst.html">i2c_inst_t</a> *i2c);</div>
<div class="line"><a id="l00125" name="l00125"></a><span class="lineno">  125</span> </div>
<div class="line"><a id="l00137" name="l00137"></a><span class="lineno">  137</span>uint <a class="code hl_function" href="group__hardware__i2c.html#ga615525cad9398b3ec37e8208523c73b4">i2c_set_baudrate</a>(<a class="code hl_struct" href="structi2c__inst.html">i2c_inst_t</a> *i2c, uint baudrate);</div>
<div class="line"><a id="l00138" name="l00138"></a><span class="lineno">  138</span> </div>
<div class="line"><a id="l00146" name="l00146"></a><span class="lineno">  146</span><span class="keywordtype">void</span> <a class="code hl_function" href="group__hardware__i2c.html#ga42571b2db5d1ed0dc083385c230dc9e8">i2c_set_slave_mode</a>(<a class="code hl_struct" href="structi2c__inst.html">i2c_inst_t</a> *i2c, <span class="keywordtype">bool</span> slave, uint8_t addr);</div>
<div class="line"><a id="l00147" name="l00147"></a><span class="lineno">  147</span> </div>
<div class="line"><a id="l00148" name="l00148"></a><span class="lineno">  148</span><span class="comment">// ----------------------------------------------------------------------------</span></div>
<div class="line"><a id="l00149" name="l00149"></a><span class="lineno">  149</span><span class="comment">// Generic input/output</span></div>
<div class="line"><a id="l00150" name="l00150"></a><span class="lineno">  150</span> </div>
<div class="line"><a id="l00151" name="l00151"></a><span class="lineno"><a class="line" href="structi2c__inst.html">  151</a></span><span class="keyword">struct </span><a class="code hl_struct" href="structi2c__inst.html">i2c_inst</a> {</div>
<div class="line"><a id="l00152" name="l00152"></a><span class="lineno">  152</span>    <a class="code hl_struct" href="structi2c__hw__t.html">i2c_hw_t</a> *hw;</div>
<div class="line"><a id="l00153" name="l00153"></a><span class="lineno">  153</span>    <span class="keywordtype">bool</span> restart_on_next;</div>
<div class="line"><a id="l00154" name="l00154"></a><span class="lineno">  154</span>};</div>
<div class="line"><a id="l00155" name="l00155"></a><span class="lineno">  155</span> </div>
<div class="line"><a id="l00164" name="l00164"></a><span class="lineno">  164</span><span class="preprocessor">#ifndef I2C_NUM</span></div>
<div class="line"><a id="l00165" name="l00165"></a><span class="lineno">  165</span><span class="keyword">static_assert</span>(NUM_I2CS == 2, <span class="stringliteral">&quot;&quot;</span>);</div>
<div class="line"><a id="l00166" name="l00166"></a><span class="lineno"><a class="line" href="group__hardware__i2c.html#ga15780f5c76a6e85e6a9d91dc6ca754bc">  166</a></span><span class="preprocessor">#define I2C_NUM(i2c) ((i2c) == i2c1)</span></div>
<div class="line"><a id="l00167" name="l00167"></a><span class="lineno">  167</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00168" name="l00168"></a><span class="lineno">  168</span> </div>
<div class="line"><a id="l00177" name="l00177"></a><span class="lineno">  177</span><span class="preprocessor">#ifndef I2C_INSTANCE</span></div>
<div class="line"><a id="l00178" name="l00178"></a><span class="lineno">  178</span><span class="keyword">static_assert</span>(NUM_I2CS == 2, <span class="stringliteral">&quot;&quot;</span>);</div>
<div class="line"><a id="l00179" name="l00179"></a><span class="lineno"><a class="line" href="group__hardware__i2c.html#gaaa18845e47b403a6a54008a776f56b46">  179</a></span><span class="preprocessor">#define I2C_INSTANCE(num) ((num) ? i2c1 : i2c0)</span></div>
<div class="line"><a id="l00180" name="l00180"></a><span class="lineno">  180</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00181" name="l00181"></a><span class="lineno">  181</span> </div>
<div class="line"><a id="l00191" name="l00191"></a><span class="lineno">  191</span><span class="preprocessor">#ifndef I2C_DREQ_NUM</span></div>
<div class="line"><a id="l00192" name="l00192"></a><span class="lineno">  192</span><span class="keyword">static_assert</span>(<a class="code hl_enumvalue" href="group__hardware__dma.html#gga6f0a19defc495cfa6078364122266014a675d15a4afa861045235a441d46d0580">DREQ_I2C0_RX</a> == <a class="code hl_enumvalue" href="group__hardware__dma.html#gga6f0a19defc495cfa6078364122266014ab51c1095a1fec8ad39050cf49fd01835">DREQ_I2C0_TX</a> + 1, <span class="stringliteral">&quot;&quot;</span>);</div>
<div class="line"><a id="l00193" name="l00193"></a><span class="lineno">  193</span><span class="keyword">static_assert</span>(<a class="code hl_enumvalue" href="group__hardware__dma.html#gga6f0a19defc495cfa6078364122266014a0b5156eb2381872ddc1837d83de16b8b">DREQ_I2C1_RX</a> == <a class="code hl_enumvalue" href="group__hardware__dma.html#gga6f0a19defc495cfa6078364122266014a74c786868da56dbb18b7da2c7748568f">DREQ_I2C1_TX</a> + 1, <span class="stringliteral">&quot;&quot;</span>);</div>
<div class="line"><a id="l00194" name="l00194"></a><span class="lineno">  194</span><span class="keyword">static_assert</span>(<a class="code hl_enumvalue" href="group__hardware__dma.html#gga6f0a19defc495cfa6078364122266014a74c786868da56dbb18b7da2c7748568f">DREQ_I2C1_TX</a> == <a class="code hl_enumvalue" href="group__hardware__dma.html#gga6f0a19defc495cfa6078364122266014ab51c1095a1fec8ad39050cf49fd01835">DREQ_I2C0_TX</a> + 2, <span class="stringliteral">&quot;&quot;</span>);</div>
<div class="line"><a id="l00195" name="l00195"></a><span class="lineno"><a class="line" href="group__hardware__i2c.html#ga6e96753676145c21b2165f6fde8e0f2a">  195</a></span><span class="preprocessor">#define I2C_DREQ_NUM(i2c,is_tx) (DREQ_I2C0_TX + I2C_NUM(i2c) * 2 + !(is_tx))</span></div>
<div class="line"><a id="l00196" name="l00196"></a><span class="lineno">  196</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00197" name="l00197"></a><span class="lineno">  197</span> </div>
<div class="line"><a id="l00204" name="l00204"></a><span class="lineno"><a class="line" href="group__hardware__i2c.html#gaae747755a45e2fbf96d60bfbc7837f5d">  204</a></span><span class="keyword">static</span> <span class="keyword">inline</span> uint <a class="code hl_function" href="group__hardware__i2c.html#gaae747755a45e2fbf96d60bfbc7837f5d">i2c_get_index</a>(<a class="code hl_struct" href="structi2c__inst.html">i2c_inst_t</a> *i2c) {</div>
<div class="line"><a id="l00205" name="l00205"></a><span class="lineno">  205</span>    invalid_params_if(HARDWARE_I2C, i2c != <a class="code hl_define" href="rp2__common_2hardware__i2c_2include_2hardware_2i2c_8h.html#a46204d38a512926541fd8bac2b62c720">i2c0</a> &amp;&amp; i2c != <a class="code hl_define" href="rp2__common_2hardware__i2c_2include_2hardware_2i2c_8h.html#a87659b485d9e76dfc3bcef208ac4b573">i2c1</a>);</div>
<div class="line"><a id="l00206" name="l00206"></a><span class="lineno">  206</span>    <span class="keywordflow">return</span> <a class="code hl_define" href="group__hardware__i2c.html#ga15780f5c76a6e85e6a9d91dc6ca754bc">I2C_NUM</a>(i2c);</div>
<div class="line"><a id="l00207" name="l00207"></a><span class="lineno">  207</span>}</div>
<div class="line"><a id="l00208" name="l00208"></a><span class="lineno">  208</span> </div>
<div class="line"><a id="l00209" name="l00209"></a><span class="lineno">  209</span><span class="comment">// backward compatibility</span></div>
<div class="line"><a id="l00210" name="l00210"></a><span class="lineno">  210</span><span class="preprocessor">#define i2c_hw_index(i2c) i2c_get_index(i2c)</span></div>
<div class="line"><a id="l00211" name="l00211"></a><span class="lineno">  211</span> </div>
<div class="line"><a id="l00218" name="l00218"></a><span class="lineno"><a class="line" href="group__hardware__i2c.html#gafb868326e8b0bef077a98e1302b0ff9a">  218</a></span><span class="keyword">static</span> <span class="keyword">inline</span> <a class="code hl_struct" href="structi2c__hw__t.html">i2c_hw_t</a> *<a class="code hl_function" href="group__hardware__i2c.html#gafb868326e8b0bef077a98e1302b0ff9a">i2c_get_hw</a>(<a class="code hl_struct" href="structi2c__inst.html">i2c_inst_t</a> *i2c) {</div>
<div class="line"><a id="l00219" name="l00219"></a><span class="lineno">  219</span>    i2c_hw_index(i2c); <span class="comment">// check it is a hw i2c</span></div>
<div class="line"><a id="l00220" name="l00220"></a><span class="lineno">  220</span>    <span class="keywordflow">return</span> i2c-&gt;hw;</div>
<div class="line"><a id="l00221" name="l00221"></a><span class="lineno">  221</span>}</div>
<div class="line"><a id="l00222" name="l00222"></a><span class="lineno">  222</span> </div>
<div class="line"><a id="l00229" name="l00229"></a><span class="lineno"><a class="line" href="group__hardware__i2c.html#ga2a132ff74d7b816a6238037fa0e0c2c4">  229</a></span><span class="keyword">static</span> <span class="keyword">inline</span> <a class="code hl_struct" href="structi2c__inst.html">i2c_inst_t</a> *<a class="code hl_function" href="group__hardware__i2c.html#ga2a132ff74d7b816a6238037fa0e0c2c4">i2c_get_instance</a>(uint num) {</div>
<div class="line"><a id="l00230" name="l00230"></a><span class="lineno">  230</span>    invalid_params_if(HARDWARE_I2C, num &gt;= NUM_I2CS);</div>
<div class="line"><a id="l00231" name="l00231"></a><span class="lineno">  231</span>    <span class="keywordflow">return</span> <a class="code hl_define" href="group__hardware__i2c.html#gaaa18845e47b403a6a54008a776f56b46">I2C_INSTANCE</a>(num);</div>
<div class="line"><a id="l00232" name="l00232"></a><span class="lineno">  232</span>}</div>
<div class="line"><a id="l00233" name="l00233"></a><span class="lineno">  233</span> </div>
<div class="line"><a id="l00249" name="l00249"></a><span class="lineno">  249</span><span class="keywordtype">int</span> <a class="code hl_function" href="group__hardware__i2c.html#gafbad5cc392c9c22618ff9fe3b0f20ea5">i2c_write_blocking_until</a>(<a class="code hl_struct" href="structi2c__inst.html">i2c_inst_t</a> *i2c, uint8_t addr, <span class="keyword">const</span> uint8_t *src, <span class="keywordtype">size_t</span> len, <span class="keywordtype">bool</span> nostop, <a class="code hl_typedef" href="group__timestamp.html#ga8b7f3d602cc053f05bacceeacc257ed8">absolute_time_t</a> until);</div>
<div class="line"><a id="l00250" name="l00250"></a><span class="lineno">  250</span> </div>
<div class="line"><a id="l00263" name="l00263"></a><span class="lineno">  263</span><span class="keywordtype">int</span> <a class="code hl_function" href="group__hardware__i2c.html#ga186c30fab0a661586493c8d51a493850">i2c_read_blocking_until</a>(<a class="code hl_struct" href="structi2c__inst.html">i2c_inst_t</a> *i2c, uint8_t addr, uint8_t *dst, <span class="keywordtype">size_t</span> len, <span class="keywordtype">bool</span> nostop, <a class="code hl_typedef" href="group__timestamp.html#ga8b7f3d602cc053f05bacceeacc257ed8">absolute_time_t</a> until);</div>
<div class="line"><a id="l00264" name="l00264"></a><span class="lineno">  264</span> </div>
<div class="line"><a id="l00280" name="l00280"></a><span class="lineno"><a class="line" href="group__hardware__i2c.html#ga0abb49ca0282530c2655f188b72eb653">  280</a></span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code hl_function" href="group__hardware__i2c.html#ga0abb49ca0282530c2655f188b72eb653">i2c_write_timeout_us</a>(<a class="code hl_struct" href="structi2c__inst.html">i2c_inst_t</a> *i2c, uint8_t addr, <span class="keyword">const</span> uint8_t *src, <span class="keywordtype">size_t</span> len, <span class="keywordtype">bool</span> nostop, uint timeout_us) {</div>
<div class="line"><a id="l00281" name="l00281"></a><span class="lineno">  281</span>    <a class="code hl_typedef" href="group__timestamp.html#ga8b7f3d602cc053f05bacceeacc257ed8">absolute_time_t</a> t = <a class="code hl_function" href="group__timestamp.html#ga70921b9073202a54eec3494b4d19ec84">make_timeout_time_us</a>(timeout_us);</div>
<div class="line"><a id="l00282" name="l00282"></a><span class="lineno">  282</span>    <span class="keywordflow">return</span> <a class="code hl_function" href="group__hardware__i2c.html#gafbad5cc392c9c22618ff9fe3b0f20ea5">i2c_write_blocking_until</a>(i2c, addr, src, len, nostop, t);</div>
<div class="line"><a id="l00283" name="l00283"></a><span class="lineno">  283</span>}</div>
<div class="line"><a id="l00284" name="l00284"></a><span class="lineno">  284</span> </div>
<div class="line"><a id="l00285" name="l00285"></a><span class="lineno">  285</span><span class="keywordtype">int</span> i2c_write_timeout_per_char_us(<a class="code hl_struct" href="structi2c__inst.html">i2c_inst_t</a> *i2c, uint8_t addr, <span class="keyword">const</span> uint8_t *src, <span class="keywordtype">size_t</span> len, <span class="keywordtype">bool</span> nostop, uint timeout_per_char_us);</div>
<div class="line"><a id="l00286" name="l00286"></a><span class="lineno">  286</span> </div>
<div class="line"><a id="l00299" name="l00299"></a><span class="lineno"><a class="line" href="group__hardware__i2c.html#ga9662f16f2e0def852f8fc051e695528d">  299</a></span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code hl_function" href="group__hardware__i2c.html#ga9662f16f2e0def852f8fc051e695528d">i2c_read_timeout_us</a>(<a class="code hl_struct" href="structi2c__inst.html">i2c_inst_t</a> *i2c, uint8_t addr, uint8_t *dst, <span class="keywordtype">size_t</span> len, <span class="keywordtype">bool</span> nostop, uint timeout_us) {</div>
<div class="line"><a id="l00300" name="l00300"></a><span class="lineno">  300</span>    <a class="code hl_typedef" href="group__timestamp.html#ga8b7f3d602cc053f05bacceeacc257ed8">absolute_time_t</a> t = <a class="code hl_function" href="group__timestamp.html#ga70921b9073202a54eec3494b4d19ec84">make_timeout_time_us</a>(timeout_us);</div>
<div class="line"><a id="l00301" name="l00301"></a><span class="lineno">  301</span>    <span class="keywordflow">return</span> <a class="code hl_function" href="group__hardware__i2c.html#ga186c30fab0a661586493c8d51a493850">i2c_read_blocking_until</a>(i2c, addr, dst, len, nostop, t);</div>
<div class="line"><a id="l00302" name="l00302"></a><span class="lineno">  302</span>}</div>
<div class="line"><a id="l00303" name="l00303"></a><span class="lineno">  303</span> </div>
<div class="line"><a id="l00304" name="l00304"></a><span class="lineno">  304</span><span class="keywordtype">int</span> i2c_read_timeout_per_char_us(<a class="code hl_struct" href="structi2c__inst.html">i2c_inst_t</a> *i2c, uint8_t addr, uint8_t *dst, <span class="keywordtype">size_t</span> len, <span class="keywordtype">bool</span> nostop, uint timeout_per_char_us);</div>
<div class="line"><a id="l00305" name="l00305"></a><span class="lineno">  305</span> </div>
<div class="line"><a id="l00317" name="l00317"></a><span class="lineno">  317</span><span class="keywordtype">int</span> <a class="code hl_function" href="group__hardware__i2c.html#ga5149e9af84926fa19db6677691ab2900">i2c_write_blocking</a>(<a class="code hl_struct" href="structi2c__inst.html">i2c_inst_t</a> *i2c, uint8_t addr, <span class="keyword">const</span> uint8_t *src, <span class="keywordtype">size_t</span> len, <span class="keywordtype">bool</span> nostop);</div>
<div class="line"><a id="l00318" name="l00318"></a><span class="lineno">  318</span> </div>
<div class="line"><a id="l00332" name="l00332"></a><span class="lineno">  332</span><span class="keywordtype">int</span> <a class="code hl_function" href="group__hardware__i2c.html#ga550d01d4619f702db34355b9e570b1b1">i2c_write_burst_blocking</a>(<a class="code hl_struct" href="structi2c__inst.html">i2c_inst_t</a> *i2c, uint8_t addr, <span class="keyword">const</span> uint8_t *src, <span class="keywordtype">size_t</span> len);</div>
<div class="line"><a id="l00333" name="l00333"></a><span class="lineno">  333</span> </div>
<div class="line"><a id="l00345" name="l00345"></a><span class="lineno">  345</span><span class="keywordtype">int</span> <a class="code hl_function" href="group__hardware__i2c.html#gaba4ea440285edec58eba507308c568c6">i2c_read_blocking</a>(<a class="code hl_struct" href="structi2c__inst.html">i2c_inst_t</a> *i2c, uint8_t addr, uint8_t *dst, <span class="keywordtype">size_t</span> len, <span class="keywordtype">bool</span> nostop);</div>
<div class="line"><a id="l00346" name="l00346"></a><span class="lineno">  346</span> </div>
<div class="line"><a id="l00360" name="l00360"></a><span class="lineno">  360</span><span class="keywordtype">int</span> <a class="code hl_function" href="group__hardware__i2c.html#gafb20f515799c0a68ed597eed1ad9828a">i2c_read_burst_blocking</a>(<a class="code hl_struct" href="structi2c__inst.html">i2c_inst_t</a> *i2c, uint8_t addr, uint8_t *dst, <span class="keywordtype">size_t</span> len);</div>
<div class="line"><a id="l00361" name="l00361"></a><span class="lineno">  361</span> </div>
<div class="line"><a id="l00369" name="l00369"></a><span class="lineno"><a class="line" href="group__hardware__i2c.html#ga93f40022189e591521dd0ae5e29708ff">  369</a></span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">size_t</span> <a class="code hl_function" href="group__hardware__i2c.html#ga93f40022189e591521dd0ae5e29708ff">i2c_get_write_available</a>(<a class="code hl_struct" href="structi2c__inst.html">i2c_inst_t</a> *i2c) {</div>
<div class="line"><a id="l00370" name="l00370"></a><span class="lineno">  370</span>    <span class="keyword">const</span> <span class="keywordtype">size_t</span> IC_TX_BUFFER_DEPTH = 16;</div>
<div class="line"><a id="l00371" name="l00371"></a><span class="lineno">  371</span>    <span class="keywordflow">return</span> IC_TX_BUFFER_DEPTH - <a class="code hl_function" href="group__hardware__i2c.html#gafb868326e8b0bef077a98e1302b0ff9a">i2c_get_hw</a>(i2c)-&gt;txflr;</div>
<div class="line"><a id="l00372" name="l00372"></a><span class="lineno">  372</span>}</div>
<div class="line"><a id="l00373" name="l00373"></a><span class="lineno">  373</span> </div>
<div class="line"><a id="l00381" name="l00381"></a><span class="lineno"><a class="line" href="group__hardware__i2c.html#ga5df361f77f110bbc2b63baa999507bde">  381</a></span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">size_t</span> <a class="code hl_function" href="group__hardware__i2c.html#ga5df361f77f110bbc2b63baa999507bde">i2c_get_read_available</a>(<a class="code hl_struct" href="structi2c__inst.html">i2c_inst_t</a> *i2c) {</div>
<div class="line"><a id="l00382" name="l00382"></a><span class="lineno">  382</span>    <span class="keywordflow">return</span> <a class="code hl_function" href="group__hardware__i2c.html#gafb868326e8b0bef077a98e1302b0ff9a">i2c_get_hw</a>(i2c)-&gt;rxflr;</div>
<div class="line"><a id="l00383" name="l00383"></a><span class="lineno">  383</span>}</div>
<div class="line"><a id="l00384" name="l00384"></a><span class="lineno">  384</span> </div>
<div class="line"><a id="l00395" name="l00395"></a><span class="lineno"><a class="line" href="group__hardware__i2c.html#gaf33250d48e1ad099b1ade910fa97e38d">  395</a></span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code hl_function" href="group__hardware__i2c.html#gaf33250d48e1ad099b1ade910fa97e38d">i2c_write_raw_blocking</a>(<a class="code hl_struct" href="structi2c__inst.html">i2c_inst_t</a> *i2c, <span class="keyword">const</span> uint8_t *src, <span class="keywordtype">size_t</span> len) {</div>
<div class="line"><a id="l00396" name="l00396"></a><span class="lineno">  396</span>    <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; len; ++i) {</div>
<div class="line"><a id="l00397" name="l00397"></a><span class="lineno">  397</span>        <span class="comment">// TODO NACK or STOP on end?</span></div>
<div class="line"><a id="l00398" name="l00398"></a><span class="lineno">  398</span>        <span class="keywordflow">while</span> (!<a class="code hl_function" href="group__hardware__i2c.html#ga93f40022189e591521dd0ae5e29708ff">i2c_get_write_available</a>(i2c))</div>
<div class="line"><a id="l00399" name="l00399"></a><span class="lineno">  399</span>            <a class="code hl_function" href="group__pico__platform.html#gab0d1ba75ceb64131e19f613d7a5313c9">tight_loop_contents</a>();</div>
<div class="line"><a id="l00400" name="l00400"></a><span class="lineno">  400</span>        <a class="code hl_function" href="group__hardware__i2c.html#gafb868326e8b0bef077a98e1302b0ff9a">i2c_get_hw</a>(i2c)-&gt;data_cmd = *src++;</div>
<div class="line"><a id="l00401" name="l00401"></a><span class="lineno">  401</span>    }</div>
<div class="line"><a id="l00402" name="l00402"></a><span class="lineno">  402</span>}</div>
<div class="line"><a id="l00403" name="l00403"></a><span class="lineno">  403</span> </div>
<div class="line"><a id="l00414" name="l00414"></a><span class="lineno"><a class="line" href="group__hardware__i2c.html#gacb6879852dedc00403f8c345e6d64611">  414</a></span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code hl_function" href="group__hardware__i2c.html#gacb6879852dedc00403f8c345e6d64611">i2c_read_raw_blocking</a>(<a class="code hl_struct" href="structi2c__inst.html">i2c_inst_t</a> *i2c, uint8_t *dst, <span class="keywordtype">size_t</span> len) {</div>
<div class="line"><a id="l00415" name="l00415"></a><span class="lineno">  415</span>    <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; len; ++i) {</div>
<div class="line"><a id="l00416" name="l00416"></a><span class="lineno">  416</span>        <span class="keywordflow">while</span> (!<a class="code hl_function" href="group__hardware__i2c.html#ga5df361f77f110bbc2b63baa999507bde">i2c_get_read_available</a>(i2c))</div>
<div class="line"><a id="l00417" name="l00417"></a><span class="lineno">  417</span>            <a class="code hl_function" href="group__pico__platform.html#gab0d1ba75ceb64131e19f613d7a5313c9">tight_loop_contents</a>();</div>
<div class="line"><a id="l00418" name="l00418"></a><span class="lineno">  418</span>        *dst++ = (uint8_t)<a class="code hl_function" href="group__hardware__i2c.html#gafb868326e8b0bef077a98e1302b0ff9a">i2c_get_hw</a>(i2c)-&gt;data_cmd;</div>
<div class="line"><a id="l00419" name="l00419"></a><span class="lineno">  419</span>    }</div>
<div class="line"><a id="l00420" name="l00420"></a><span class="lineno">  420</span>}</div>
<div class="line"><a id="l00421" name="l00421"></a><span class="lineno">  421</span> </div>
<div class="line"><a id="l00431" name="l00431"></a><span class="lineno"><a class="line" href="group__hardware__i2c.html#gab37f59a13576235e8bed4fffc4bc4361">  431</a></span><span class="keyword">static</span> <span class="keyword">inline</span> uint8_t <a class="code hl_function" href="group__hardware__i2c.html#gab37f59a13576235e8bed4fffc4bc4361">i2c_read_byte_raw</a>(<a class="code hl_struct" href="structi2c__inst.html">i2c_inst_t</a> *i2c) {</div>
<div class="line"><a id="l00432" name="l00432"></a><span class="lineno">  432</span>    <a class="code hl_struct" href="structi2c__hw__t.html">i2c_hw_t</a> *hw = <a class="code hl_function" href="group__hardware__i2c.html#gafb868326e8b0bef077a98e1302b0ff9a">i2c_get_hw</a>(i2c);</div>
<div class="line"><a id="l00433" name="l00433"></a><span class="lineno">  433</span>    assert(hw-&gt;status &amp; I2C_IC_STATUS_RFNE_BITS); <span class="comment">// Rx FIFO must not be empty</span></div>
<div class="line"><a id="l00434" name="l00434"></a><span class="lineno">  434</span>    <span class="keywordflow">return</span> (uint8_t)hw-&gt;data_cmd;</div>
<div class="line"><a id="l00435" name="l00435"></a><span class="lineno">  435</span>}</div>
<div class="line"><a id="l00436" name="l00436"></a><span class="lineno">  436</span> </div>
<div class="line"><a id="l00446" name="l00446"></a><span class="lineno"><a class="line" href="group__hardware__i2c.html#ga966547dafbfd2bcb2016c132f26767f8">  446</a></span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code hl_function" href="group__hardware__i2c.html#ga966547dafbfd2bcb2016c132f26767f8">i2c_write_byte_raw</a>(<a class="code hl_struct" href="structi2c__inst.html">i2c_inst_t</a> *i2c, uint8_t value) {</div>
<div class="line"><a id="l00447" name="l00447"></a><span class="lineno">  447</span>    <a class="code hl_struct" href="structi2c__hw__t.html">i2c_hw_t</a> *hw = <a class="code hl_function" href="group__hardware__i2c.html#gafb868326e8b0bef077a98e1302b0ff9a">i2c_get_hw</a>(i2c);</div>
<div class="line"><a id="l00448" name="l00448"></a><span class="lineno">  448</span>    assert(hw-&gt;status &amp; I2C_IC_STATUS_TFNF_BITS); <span class="comment">// Tx FIFO must not be full</span></div>
<div class="line"><a id="l00449" name="l00449"></a><span class="lineno">  449</span>    hw-&gt;data_cmd = value;</div>
<div class="line"><a id="l00450" name="l00450"></a><span class="lineno">  450</span>}</div>
<div class="line"><a id="l00451" name="l00451"></a><span class="lineno">  451</span> </div>
<div class="line"><a id="l00458" name="l00458"></a><span class="lineno"><a class="line" href="group__hardware__i2c.html#gacce469d1b8f8dc9548d1932c5838d9d9">  458</a></span><span class="keyword">static</span> <span class="keyword">inline</span> uint <a class="code hl_function" href="group__hardware__i2c.html#gacce469d1b8f8dc9548d1932c5838d9d9">i2c_get_dreq</a>(<a class="code hl_struct" href="structi2c__inst.html">i2c_inst_t</a> *i2c, <span class="keywordtype">bool</span> is_tx) {</div>
<div class="line"><a id="l00459" name="l00459"></a><span class="lineno">  459</span>    <span class="keywordflow">return</span> <a class="code hl_define" href="group__hardware__i2c.html#ga6e96753676145c21b2165f6fde8e0f2a">I2C_DREQ_NUM</a>(i2c, is_tx);</div>
<div class="line"><a id="l00460" name="l00460"></a><span class="lineno">  460</span>}</div>
<div class="line"><a id="l00461" name="l00461"></a><span class="lineno">  461</span> </div>
<div class="line"><a id="l00462" name="l00462"></a><span class="lineno">  462</span><span class="preprocessor">#ifdef __cplusplus</span></div>
<div class="line"><a id="l00463" name="l00463"></a><span class="lineno">  463</span>}</div>
<div class="line"><a id="l00464" name="l00464"></a><span class="lineno">  464</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00465" name="l00465"></a><span class="lineno">  465</span> </div>
<div class="line"><a id="l00466" name="l00466"></a><span class="lineno">  466</span><span class="preprocessor">#endif</span></div>
<div class="ttc" id="acommon_2pico__time_2include_2pico_2time_8h_html"><div class="ttname"><a href="common_2pico__time_2include_2pico_2time_8h.html">time.h</a></div></div>
<div class="ttc" id="agroup__hardware__dma_html_gga6f0a19defc495cfa6078364122266014a0b5156eb2381872ddc1837d83de16b8b"><div class="ttname"><a href="group__hardware__dma.html#gga6f0a19defc495cfa6078364122266014a0b5156eb2381872ddc1837d83de16b8b">DREQ_I2C1_RX</a></div><div class="ttdeci">@ DREQ_I2C1_RX</div><div class="ttdoc">Select I2C1's RX FIFO as DREQ.</div><div class="ttdef"><b>Definition:</b> dreq.h:129</div></div>
<div class="ttc" id="agroup__hardware__dma_html_gga6f0a19defc495cfa6078364122266014a675d15a4afa861045235a441d46d0580"><div class="ttname"><a href="group__hardware__dma.html#gga6f0a19defc495cfa6078364122266014a675d15a4afa861045235a441d46d0580">DREQ_I2C0_RX</a></div><div class="ttdeci">@ DREQ_I2C0_RX</div><div class="ttdoc">Select I2C0's RX FIFO as DREQ.</div><div class="ttdef"><b>Definition:</b> dreq.h:127</div></div>
<div class="ttc" id="agroup__hardware__dma_html_gga6f0a19defc495cfa6078364122266014a74c786868da56dbb18b7da2c7748568f"><div class="ttname"><a href="group__hardware__dma.html#gga6f0a19defc495cfa6078364122266014a74c786868da56dbb18b7da2c7748568f">DREQ_I2C1_TX</a></div><div class="ttdeci">@ DREQ_I2C1_TX</div><div class="ttdoc">Select I2C1's TX FIFO as DREQ.</div><div class="ttdef"><b>Definition:</b> dreq.h:128</div></div>
<div class="ttc" id="agroup__hardware__dma_html_gga6f0a19defc495cfa6078364122266014ab51c1095a1fec8ad39050cf49fd01835"><div class="ttname"><a href="group__hardware__dma.html#gga6f0a19defc495cfa6078364122266014ab51c1095a1fec8ad39050cf49fd01835">DREQ_I2C0_TX</a></div><div class="ttdeci">@ DREQ_I2C0_TX</div><div class="ttdoc">Select I2C0's TX FIFO as DREQ.</div><div class="ttdef"><b>Definition:</b> dreq.h:126</div></div>
<div class="ttc" id="agroup__hardware__i2c_html_ga0abb49ca0282530c2655f188b72eb653"><div class="ttname"><a href="group__hardware__i2c.html#ga0abb49ca0282530c2655f188b72eb653">i2c_write_timeout_us</a></div><div class="ttdeci">static int i2c_write_timeout_us(i2c_inst_t *i2c, uint8_t addr, const uint8_t *src, size_t len, bool nostop, uint timeout_us)</div><div class="ttdoc">Attempt to write specified number of bytes to address, with timeout.</div><div class="ttdef"><b>Definition:</b> i2c.h:280</div></div>
<div class="ttc" id="agroup__hardware__i2c_html_ga15780f5c76a6e85e6a9d91dc6ca754bc"><div class="ttname"><a href="group__hardware__i2c.html#ga15780f5c76a6e85e6a9d91dc6ca754bc">I2C_NUM</a></div><div class="ttdeci">#define I2C_NUM(i2c)</div><div class="ttdoc">Returns the I2C number for a I2C instance.</div><div class="ttdef"><b>Definition:</b> i2c.h:166</div></div>
<div class="ttc" id="agroup__hardware__i2c_html_ga186c30fab0a661586493c8d51a493850"><div class="ttname"><a href="group__hardware__i2c.html#ga186c30fab0a661586493c8d51a493850">i2c_read_blocking_until</a></div><div class="ttdeci">int i2c_read_blocking_until(i2c_inst_t *i2c, uint8_t addr, uint8_t *dst, size_t len, bool nostop, absolute_time_t until)</div><div class="ttdoc">Attempt to read specified number of bytes from address, blocking until the specified absolute time is...</div><div class="ttdef"><b>Definition:</b> i2c.c:342</div></div>
<div class="ttc" id="agroup__hardware__i2c_html_ga2a132ff74d7b816a6238037fa0e0c2c4"><div class="ttname"><a href="group__hardware__i2c.html#ga2a132ff74d7b816a6238037fa0e0c2c4">i2c_get_instance</a></div><div class="ttdeci">static i2c_inst_t * i2c_get_instance(uint num)</div><div class="ttdoc">Convert I2C hardware instance number to I2C instance.</div><div class="ttdef"><b>Definition:</b> i2c.h:229</div></div>
<div class="ttc" id="agroup__hardware__i2c_html_ga2e2ac8f345157b0095fc463ac3e584ba"><div class="ttname"><a href="group__hardware__i2c.html#ga2e2ac8f345157b0095fc463ac3e584ba">i2c_deinit</a></div><div class="ttdeci">void i2c_deinit(i2c_inst_t *i2c)</div><div class="ttdoc">Disable the I2C HW block.</div><div class="ttdef"><b>Definition:</b> i2c.c:58</div></div>
<div class="ttc" id="agroup__hardware__i2c_html_ga42571b2db5d1ed0dc083385c230dc9e8"><div class="ttname"><a href="group__hardware__i2c.html#ga42571b2db5d1ed0dc083385c230dc9e8">i2c_set_slave_mode</a></div><div class="ttdeci">void i2c_set_slave_mode(i2c_inst_t *i2c, bool slave, uint8_t addr)</div><div class="ttdoc">Set I2C port to slave mode.</div><div class="ttdef"><b>Definition:</b> i2c.c:112</div></div>
<div class="ttc" id="agroup__hardware__i2c_html_ga5149e9af84926fa19db6677691ab2900"><div class="ttname"><a href="group__hardware__i2c.html#ga5149e9af84926fa19db6677691ab2900">i2c_write_blocking</a></div><div class="ttdeci">int i2c_write_blocking(i2c_inst_t *i2c, uint8_t addr, const uint8_t *src, size_t len, bool nostop)</div><div class="ttdoc">Attempt to write specified number of bytes to address, blocking.</div><div class="ttdef"><b>Definition:</b> i2c.c:245</div></div>
<div class="ttc" id="agroup__hardware__i2c_html_ga550d01d4619f702db34355b9e570b1b1"><div class="ttname"><a href="group__hardware__i2c.html#ga550d01d4619f702db34355b9e570b1b1">i2c_write_burst_blocking</a></div><div class="ttdeci">int i2c_write_burst_blocking(i2c_inst_t *i2c, uint8_t addr, const uint8_t *src, size_t len)</div><div class="ttdoc">Attempt to write specified number of bytes to address, blocking in burst mode.</div><div class="ttdef"><b>Definition:</b> i2c.c:262</div></div>
<div class="ttc" id="agroup__hardware__i2c_html_ga56c7844696c095a3ad088100df011fd2"><div class="ttname"><a href="group__hardware__i2c.html#ga56c7844696c095a3ad088100df011fd2">i2c0_inst</a></div><div class="ttdeci">i2c_inst_t i2c0_inst</div><div class="ttdef"><b>Definition:</b> i2c.c:15</div></div>
<div class="ttc" id="agroup__hardware__i2c_html_ga5df361f77f110bbc2b63baa999507bde"><div class="ttname"><a href="group__hardware__i2c.html#ga5df361f77f110bbc2b63baa999507bde">i2c_get_read_available</a></div><div class="ttdeci">static size_t i2c_get_read_available(i2c_inst_t *i2c)</div><div class="ttdoc">Determine number of bytes received.</div><div class="ttdef"><b>Definition:</b> i2c.h:381</div></div>
<div class="ttc" id="agroup__hardware__i2c_html_ga615525cad9398b3ec37e8208523c73b4"><div class="ttname"><a href="group__hardware__i2c.html#ga615525cad9398b3ec37e8208523c73b4">i2c_set_baudrate</a></div><div class="ttdeci">uint i2c_set_baudrate(i2c_inst_t *i2c, uint baudrate)</div><div class="ttdoc">Set I2C baudrate.</div><div class="ttdef"><b>Definition:</b> i2c.c:62</div></div>
<div class="ttc" id="agroup__hardware__i2c_html_ga6e96753676145c21b2165f6fde8e0f2a"><div class="ttname"><a href="group__hardware__i2c.html#ga6e96753676145c21b2165f6fde8e0f2a">I2C_DREQ_NUM</a></div><div class="ttdeci">#define I2C_DREQ_NUM(i2c, is_tx)</div><div class="ttdoc">Returns the dreq_num_t used for pacing DMA transfers to or from this I2C instance....</div><div class="ttdef"><b>Definition:</b> i2c.h:195</div></div>
<div class="ttc" id="agroup__hardware__i2c_html_ga93f40022189e591521dd0ae5e29708ff"><div class="ttname"><a href="group__hardware__i2c.html#ga93f40022189e591521dd0ae5e29708ff">i2c_get_write_available</a></div><div class="ttdeci">static size_t i2c_get_write_available(i2c_inst_t *i2c)</div><div class="ttdoc">Determine non-blocking write space available.</div><div class="ttdef"><b>Definition:</b> i2c.h:369</div></div>
<div class="ttc" id="agroup__hardware__i2c_html_ga9662f16f2e0def852f8fc051e695528d"><div class="ttname"><a href="group__hardware__i2c.html#ga9662f16f2e0def852f8fc051e695528d">i2c_read_timeout_us</a></div><div class="ttdeci">static int i2c_read_timeout_us(i2c_inst_t *i2c, uint8_t addr, uint8_t *dst, size_t len, bool nostop, uint timeout_us)</div><div class="ttdoc">Attempt to read specified number of bytes from address, with timeout.</div><div class="ttdef"><b>Definition:</b> i2c.h:299</div></div>
<div class="ttc" id="agroup__hardware__i2c_html_ga966547dafbfd2bcb2016c132f26767f8"><div class="ttname"><a href="group__hardware__i2c.html#ga966547dafbfd2bcb2016c132f26767f8">i2c_write_byte_raw</a></div><div class="ttdeci">static void i2c_write_byte_raw(i2c_inst_t *i2c, uint8_t value)</div><div class="ttdoc">Push a byte into I2C Tx FIFO.</div><div class="ttdef"><b>Definition:</b> i2c.h:446</div></div>
<div class="ttc" id="agroup__hardware__i2c_html_gaaa18845e47b403a6a54008a776f56b46"><div class="ttname"><a href="group__hardware__i2c.html#gaaa18845e47b403a6a54008a776f56b46">I2C_INSTANCE</a></div><div class="ttdeci">#define I2C_INSTANCE(num)</div><div class="ttdoc">Returns the I2C instance with the given I2C number.</div><div class="ttdef"><b>Definition:</b> i2c.h:179</div></div>
<div class="ttc" id="agroup__hardware__i2c_html_gaae747755a45e2fbf96d60bfbc7837f5d"><div class="ttname"><a href="group__hardware__i2c.html#gaae747755a45e2fbf96d60bfbc7837f5d">i2c_get_index</a></div><div class="ttdeci">static uint i2c_get_index(i2c_inst_t *i2c)</div><div class="ttdoc">Convert I2C instance to hardware instance number.</div><div class="ttdef"><b>Definition:</b> i2c.h:204</div></div>
<div class="ttc" id="agroup__hardware__i2c_html_gab37f59a13576235e8bed4fffc4bc4361"><div class="ttname"><a href="group__hardware__i2c.html#gab37f59a13576235e8bed4fffc4bc4361">i2c_read_byte_raw</a></div><div class="ttdeci">static uint8_t i2c_read_byte_raw(i2c_inst_t *i2c)</div><div class="ttdoc">Pop a byte from I2C Rx FIFO.</div><div class="ttdef"><b>Definition:</b> i2c.h:431</div></div>
<div class="ttc" id="agroup__hardware__i2c_html_gaba4ea440285edec58eba507308c568c6"><div class="ttname"><a href="group__hardware__i2c.html#gaba4ea440285edec58eba507308c568c6">i2c_read_blocking</a></div><div class="ttdeci">int i2c_read_blocking(i2c_inst_t *i2c, uint8_t addr, uint8_t *dst, size_t len, bool nostop)</div><div class="ttdoc">Attempt to read specified number of bytes from address, blocking.</div><div class="ttdef"><b>Definition:</b> i2c.c:338</div></div>
<div class="ttc" id="agroup__hardware__i2c_html_gacb6879852dedc00403f8c345e6d64611"><div class="ttname"><a href="group__hardware__i2c.html#gacb6879852dedc00403f8c345e6d64611">i2c_read_raw_blocking</a></div><div class="ttdeci">static void i2c_read_raw_blocking(i2c_inst_t *i2c, uint8_t *dst, size_t len)</div><div class="ttdoc">Read direct from RX FIFO.</div><div class="ttdef"><b>Definition:</b> i2c.h:414</div></div>
<div class="ttc" id="agroup__hardware__i2c_html_gacce469d1b8f8dc9548d1932c5838d9d9"><div class="ttname"><a href="group__hardware__i2c.html#gacce469d1b8f8dc9548d1932c5838d9d9">i2c_get_dreq</a></div><div class="ttdeci">static uint i2c_get_dreq(i2c_inst_t *i2c, bool is_tx)</div><div class="ttdoc">Return the DREQ to use for pacing transfers to/from a particular I2C instance.</div><div class="ttdef"><b>Definition:</b> i2c.h:458</div></div>
<div class="ttc" id="agroup__hardware__i2c_html_gad31793849a130033e94fa5b8e98a30a8"><div class="ttname"><a href="group__hardware__i2c.html#gad31793849a130033e94fa5b8e98a30a8">i2c_init</a></div><div class="ttdeci">uint i2c_init(i2c_inst_t *i2c, uint baudrate)</div><div class="ttdoc">Initialise the I2C HW block.</div><div class="ttdef"><b>Definition:</b> i2c.c:32</div></div>
<div class="ttc" id="agroup__hardware__i2c_html_gaf33250d48e1ad099b1ade910fa97e38d"><div class="ttname"><a href="group__hardware__i2c.html#gaf33250d48e1ad099b1ade910fa97e38d">i2c_write_raw_blocking</a></div><div class="ttdeci">static void i2c_write_raw_blocking(i2c_inst_t *i2c, const uint8_t *src, size_t len)</div><div class="ttdoc">Write direct to TX FIFO.</div><div class="ttdef"><b>Definition:</b> i2c.h:395</div></div>
<div class="ttc" id="agroup__hardware__i2c_html_gafb20f515799c0a68ed597eed1ad9828a"><div class="ttname"><a href="group__hardware__i2c.html#gafb20f515799c0a68ed597eed1ad9828a">i2c_read_burst_blocking</a></div><div class="ttdeci">int i2c_read_burst_blocking(i2c_inst_t *i2c, uint8_t addr, uint8_t *dst, size_t len)</div><div class="ttdoc">Attempt to read specified number of bytes from address, blocking in burst mode.</div><div class="ttdef"><b>Definition:</b> i2c.c:354</div></div>
<div class="ttc" id="agroup__hardware__i2c_html_gafb868326e8b0bef077a98e1302b0ff9a"><div class="ttname"><a href="group__hardware__i2c.html#gafb868326e8b0bef077a98e1302b0ff9a">i2c_get_hw</a></div><div class="ttdeci">static i2c_hw_t * i2c_get_hw(i2c_inst_t *i2c)</div><div class="ttdoc">Return pointer to structure containing i2c hardware registers.</div><div class="ttdef"><b>Definition:</b> i2c.h:218</div></div>
<div class="ttc" id="agroup__hardware__i2c_html_gafbad5cc392c9c22618ff9fe3b0f20ea5"><div class="ttname"><a href="group__hardware__i2c.html#gafbad5cc392c9c22618ff9fe3b0f20ea5">i2c_write_blocking_until</a></div><div class="ttdeci">int i2c_write_blocking_until(i2c_inst_t *i2c, uint8_t addr, const uint8_t *src, size_t len, bool nostop, absolute_time_t until)</div><div class="ttdoc">Attempt to write specified number of bytes to address, blocking until the specified absolute time is ...</div><div class="ttdef"><b>Definition:</b> i2c.c:249</div></div>
<div class="ttc" id="agroup__pico__platform_html_gab0d1ba75ceb64131e19f613d7a5313c9"><div class="ttname"><a href="group__pico__platform.html#gab0d1ba75ceb64131e19f613d7a5313c9">tight_loop_contents</a></div><div class="ttdeci">static __force_inline void tight_loop_contents(void)</div><div class="ttdoc">No-op function for the body of tight loops.</div><div class="ttdef"><b>Definition:</b> platform.h:80</div></div>
<div class="ttc" id="agroup__timestamp_html_ga70921b9073202a54eec3494b4d19ec84"><div class="ttname"><a href="group__timestamp.html#ga70921b9073202a54eec3494b4d19ec84">make_timeout_time_us</a></div><div class="ttdeci">static absolute_time_t make_timeout_time_us(uint64_t us)</div><div class="ttdoc">Convenience method to get the timestamp a number of microseconds from the current time.</div><div class="ttdef"><b>Definition:</b> time.h:136</div></div>
<div class="ttc" id="agroup__timestamp_html_ga8b7f3d602cc053f05bacceeacc257ed8"><div class="ttname"><a href="group__timestamp.html#ga8b7f3d602cc053f05bacceeacc257ed8">absolute_time_t</a></div><div class="ttdeci">uint64_t absolute_time_t</div><div class="ttdoc">An opaque 64 bit timestamp in microseconds.</div><div class="ttdef"><b>Definition:</b> types.h:43</div></div>
<div class="ttc" id="apico_8h_html"><div class="ttname"><a href="pico_8h.html">pico.h</a></div></div>
<div class="ttc" id="arp2__common_2hardware__i2c_2include_2hardware_2i2c_8h_html_a46204d38a512926541fd8bac2b62c720"><div class="ttname"><a href="rp2__common_2hardware__i2c_2include_2hardware_2i2c_8h.html#a46204d38a512926541fd8bac2b62c720">i2c0</a></div><div class="ttdeci">#define i2c0</div><div class="ttdoc">Identifier for I2C HW Block 0.</div><div class="ttdef"><b>Definition:</b> i2c.h:71</div></div>
<div class="ttc" id="arp2__common_2hardware__i2c_2include_2hardware_2i2c_8h_html_a87659b485d9e76dfc3bcef208ac4b573"><div class="ttname"><a href="rp2__common_2hardware__i2c_2include_2hardware_2i2c_8h.html#a87659b485d9e76dfc3bcef208ac4b573">i2c1</a></div><div class="ttdeci">#define i2c1</div><div class="ttdoc">Identifier for I2C HW Block 1.</div><div class="ttdef"><b>Definition:</b> i2c.h:72</div></div>
<div class="ttc" id="astructi2c__hw__t_html"><div class="ttname"><a href="structi2c__hw__t.html">i2c_hw_t</a></div><div class="ttdef"><b>Definition:</b> i2c.h:26</div></div>
<div class="ttc" id="astructi2c__inst_html"><div class="ttname"><a href="structi2c__inst.html">i2c_inst</a></div><div class="ttdef"><b>Definition:</b> i2c.h:151</div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->

	<script src="main.js"></script>
</body>
</html>